module.exports = app => {
    const {STRING,INTEGER,DATE} = app.Sequelize;
    var User = require('../model/user')
    const RescueStation = app.model.define('rescue_station', {
        id: {
            type: INTEGER(20),
            primaryKey: true,
            autoIncrement: true
        },
        stationName: {
            type: STRING(30),
            allowNull: false,
            defaultValue: '',
            comment: '救助站名称'
        },
        briefIntroduction: {
            type: STRING(100),
            comment: '救助站简介'
        },
        introduction: {
            type: STRING(1000),
            comment: '救助站介绍'
        },
        specificLocation: {
            type: STRING(200),
            allowNull: false,
            defaultValue: '',
            comment: '救助站具体地址'
        },
        officialPhone: {
            type: STRING(11),
            comment: '救助站官方电话'
        },
        catNum: {
            type: INTEGER(11),
            allowNull: false,
            defaultValue: 0,
            comment: '猫数量'
        },
        dogNum: {
            type: INTEGER(11),
            allowNull: false,
            defaultValue: 0,
            comment: '狗数量'
        },
        livestreamStatus: {
            type: INTEGER(11),
            allowNull: false,
            defaultValue: 0,
            comment: '是否正在直播'
        },
        funderNum: {
            type: INTEGER(11),
            allowNull: false,
            defaultValue: 0,
            comment: '累计资助人数'
        },
        funderMoney: {
            type: INTEGER(11),
            allowNull: false,
            defaultValue: 0,
            comment: '累计资助金额'
        },
        stationName: {
            type: STRING(30),
            allowNull: false,
            defaultValue: '',
            comment: '救助站名字'
        },
        coverImg: {
            type: STRING(255),
            defaultValue: '',
            comment: '救助站封面图'
        },
        created_time:DATE,
        updated_time:DATE
    });
    RescueStation.associate = function(){
        RescueStation.belongsTo(app.model.User,{as:'ori',foreignKey:'id',targetKey:'id'});
        RescueStation.belongsTo(app.model.Post,{as:'uii',foreignKey:'id',targetKey:'user_id'});
    }
    return RescueStation;
}